package com.zyk.scaffold.tcp.proto3;

import com.google.protobuf.InvalidProtocolBufferException;
import com.zyk.scaffold.tcp.proto3.MessageBuf;

public class TestMessageBuf {
    public static void main(String[] args) throws InvalidProtocolBufferException {
        byte[] hellos = MessageBuf.JMTransfer
                .newBuilder()
                .setBody(
                        MessageBuf.JMTransfer.Body.newBuilder().setMsg("hello")
                )
                .setPlatformType(MessageBuf.JMTransfer.PlatformType.DU)
                .setAppId("1111111111111111")
                .build()
                .toByteArray();
        MessageBuf.JMTransfer jmTransfer = MessageBuf.JMTransfer.parseFrom(hellos);
        System.out.println(jmTransfer.getBody().getMsg());
        System.out.println(jmTransfer.getAppId());
        System.out.println(jmTransfer.getPlatformType());
        System.out.println(hellos.length);
    }
}
